library(ape)
library(tidyverse)
library(magrittr)
library(readxl)

fileNames <- c("silicoDArT", "DArTseq")
for (fileName in fileNames) {
  data <- read_excel(str_c(fileName, ".xlsx")) %>%
    column_to_rownames("Genotype")
  meta_dist <- as.dist(1 - data)
  hc_meta <- hclust(meta_dist, method = "complete")
  phylo <- as.phylo.hclust(hc_meta)
  write.tree(phylo, file = str_c(fileName, ".nwk"))
}
